package com.tc.dispatch.csservice.util.widgt;

import java.util.List;
import java.util.ArrayList;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2008</p>
 * <p>Company: zju</p>
 * @author jakcyjia
 * @version 1.0
 */

public class BasicWidgt {

  protected  List convertClassField(Class _class)
  {
    List ret=new ArrayList();
    Field[] arr=_class.getDeclaredFields();
    for(int i=0;i<arr.length;i++)
    {
      ret.add(arr[i].getName());
    }
    return ret;
  }
  protected  Method getGetMethod(Class _class,String field) throws
      SecurityException, NoSuchMethodException {

   return _class.getMethod("get"+toUperFirst(field),null);
  }
  protected  Method setMethod(Class _class,String field,Class[] arg) throws
      SecurityException, NoSuchMethodException {

   return _class.getMethod("set"+toUperFirst(field),arg);
  }

  private  String toUperFirst(String name)
  {
    StringBuffer sb=new StringBuffer();
    return sb.append(name.substring(0,1).toUpperCase()+name.substring(1)).toString();
  }
  public  String getYieldName(String name)
  {
    if(name!=null)
      return name+"_yield";
    else
      return null;
  }
  public  String getFeeName(String name)
  {
    if(name!=null)
      return name+"_fee";
    else
      return null;
  }

}